<%-- 
    Document   : index
    Created on : 2012-3-29, 23:13:50
    Author     : yilee
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page language="java" import="com.bjtu.lms.model.Administrator"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%
	Administrator a = (Administrator) request.getSession()
			.getAttribute("admin");
	String value = (String) request.getSession().getAttribute("search");
	boolean isSearch = false;
	String name = "";
	if (a == null) {
		response.sendRedirect("login.jsp");
	} else {
		name = a.getName();
	}
	if (value == null) {
		isSearch = false;
	} else {
		isSearch = true;
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>后台管理</title>
		<link rel="stylesheet" type="text/css"
			href="../css/tripoli.simple.css" media="screen, projection, print" />
		<link rel="stylesheet" type="text/css" href="../css/layout.css"
			media="screen, projection, print" />

		<!--[if IE]>
		  <link rel="stylesheet" type="text/css" href="../css/ie/ie.css" media="screen, projection, print"
		  />
		<![endif]-->
		<!--[if lt IE 7]>
		  <script src="../js/DD_belatedPNG_0.0.7a-min.js" type="text/javascript">
		  </script>
		  <script>
			DD_belatedPNG.fix(' #header, h1, h1 a, .close, .field,.paginate .current, .icon, .required-icon, .search input');
		  </script>
		  <link rel="stylesheet" href="../css/ie/ie6.css" type="text/css" media="screen, projection"
		  />
		<![endif]-->
		<script type="text/javascript" src="../js/book.js">
</script>
	</head>

	<body>
		<!-- Header -->
		<div id="header">
			<div class="container content">
				<h1>
					<a href="#"> 图书管理系统 </a>
				</h1>

				<div class="loginInfos">
					欢迎您
					<strong> <%=name%> </strong> 管理员.
					<a href="system/settings.jsp">系统设置</a>

				</div>
			</div>
		</div>
		<!-- /Header -->
		<!-- Global -->
		<div id="page-content">
			<div class="container content">
				<!-- Sidebar -->
				<div id="sidebar" class="bImg">
					<div class="bInner">
						<span class="bTR"> </span>
						<span class="bBL"> </span>
						<ul id="side-nav">
							<li class="active">
								<a href="#" title="Posts" class="button"> <strong>
										<img src="../img/newspaper_48.png" alt="comments"
											class="icon " /> <span class="title"> 图书馆 </span> <span
										class="expand expanded"> </span> </strong> </a>
								<ul>
									<li class="active">
										<a href="#"> 图书列表 </a>
									</li>
									<li>
										<a href="book/borrowBook.jsp"> 借阅管理 </a>
									</li>
									<li>
										<a href="book/returnBook.jsp"> 归还管理 </a>
									</li>
								</ul>
							</li>

							<li class="inactive">
								<a href="#" title="Pages" class="button"> <strong>
										<img src="../img/spanner_48.png" alt="comments" class="icon " />
										<span class="title"> 用户管理 </span> <span class="expand">
									</span> </strong> </a>
								<ul>
									<li>
										<a href="viewUserListAction"> 用户列表 </a>
									</li>
								</ul>
							</li>
						</ul>
					</div>
				</div>
				<!-- /Sidebar -->
				<!-- Content -->
				<div id="content" class="roundedBorders">
					<!-- Title -->
					<div id="title" class="b2">
						<h2>
							图书管理系统
						</h2>
						<!-- TitleActions -->
						<div id="titleActions">

							<!-- newPost -->
							<div class="newPost actionBlock">
								<a href="book/addBook.jsp" class="button"> <strong>增加图书
										<img src="../img/add_48.png" class="icon " /> </strong> </a>
							</div>
							<!-- /newPost -->

						</div>
						<!-- /TitleActions -->
					</div>
					<!-- Title -->
					<div id="toolbarActions">
						<script type="text/javascript">
if(<%=isSearch%>){
								document.write("<p>搜索结果：<%=value%></p>");
							}
					
						</script>
					</div>
					<!-- Inner Content -->
					<div id="innerContent">

						<hr />

						<!-- ListTable -->
						<table cellspacing="0" class="listTable" id="postList">
							<!-- Thead -->
							<thead>
								<tr>
									<th class="first">
										<div>
										</div>
									</th>
									<th>
										<a href="#"> 图书名 </a>
									</th>
									<th>
										<a href="#"> 作者 </a>
									</th>
									<th>
										<a href="#"> 状态 </a>
									</th>
									<th class="last">
										<a href="#"> 操作 </a>
									</th>
								</tr>
							</thead>
							<!-- /Thead -->
							<!-- Tfoot -->
							<tfoot>

							</tfoot>
							<!-- /Tfoot -->
							<!-- Tbody -->
							<tbody>
								<c:forEach items="${bookList}" var="book" varStatus="i">
									<tr>
										<td>

										</td>
										<td>
											<a href="#" onclick="viewBook('${book.id}');return false;">
												${book.name} </a>
										</td>
										<td>
											${book.author}
										</td>
										<td>
											${book.borrowType}
										</td>
										<td class="last">
											<script type="text/javascript">
if ('${book.borrowType}' == "正常") {
	document.write("<a href='#' onclick='deleteBook(${book.id});'>删除</a>");

} else {
	document.write("删除");
}
document.write("<a href='beginModifyBookAction?id=${book.id}'>修改</a>");
</script>
										</td>
									</tr>
								</c:forEach>
							</tbody>
							<!-- /Tbody -->
						</table>

					</div>
					<!-- /Inner Content -->
					<div class="bBottom">
						<div>
						</div>
					</div>
				</div>
				<!-- /Content -->
				<!-- Dialog boxes -->
				<!-- /Content -->
				<div id="viewBookDetail">
					<div class="content" id="bookDetailContent">
					</div>
				</div>
				<!-- /Dialog boxes -->
			</div>
		</div>
		<script type="text/javascript" src="../js/jquery.min.js">
</script>
		<script type="text/javascript" src="../js/jquery-ui-1.7.custom.min.js">
</script>
		<script type="text/javascript" src="../js/jquery.bgiframe.min.js">
</script>
		<script type="text/javascript" src="../js/jquery.dimensions.js">
</script>
		<script type="text/javascript" src="../js/jquery.tooltip.min.js">
</script>
		<script type="text/javascript" src="../js/jquery.tablesorter.min.js">
</script>
		<script type="text/javascript" src="../js/titanium.js">
</script>
		<script type="text/javascript" src="../js/jquery.skygqbox.1.3.js">
</script>
	</body>

</html>